package com.docus.webservice.handler;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;

public class MainTest {
    public static void main(String[] args) {

        // 1、创建document对象
        Document document = DocumentHelper.createDocument();
        // 2、创建根节点rss
        Element Requst = document.addElement("Requst");
        // 4、生成子节点及子节点内容
        Element patInfo = Requst.addElement("Msg");
//        Element patInfo = Requst.addElement("PatInfo");
//        patInfo.addElement("VUID").setText("12412");
        patInfo.addElement("INHOSP_INDEX_NO").setText("345849");
        patInfo.addElement("INHOSP_NO").setText("311813");
        patInfo.addElement("EMPI_ID").setText("5555566666");
        patInfo.addElement("PAT_NAME").setText("叶启民");
        patInfo.addElement("VISIT_NO").setText("10");
        patInfo.addElement("VISIT_TYPE_CODE").setText("6669");
        patInfo.addElement("VISIT_TYPE_NAME").setText("测试");
        patInfo.addElement("DISCHARGE_DATETIME").setText("2021-05-01 00:00:00");
        patInfo.addElement("INHOSP_DAYS").setText("6");
        patInfo.addElement("ID_NUMBER").setText("356823658652365487");
        patInfo.addElement("CHAR_DOC_CODE").setText("10008");
        patInfo.addElement("DEATH_FLAG").setText("N");
//        patInfo.addElement("SIGN_OPERATOR_CODE").setText("1212");
//        patInfo.addElement("SIGN_OPERATOR_NAME").setText("12412");
        patInfo.addElement("WM_DIAG_CODE").setText("D22.10");
        patInfo.addElement("WM_DIAG_NAME").setText("主要手术6");
        patInfo.addElement("WM_DIAG_DR_CODE").setText("10008");
        patInfo.addElement("WM_DIAG_DR_NAME").setText("林文杰");
        patInfo.addElement("TCM_DIAG_CODE").setText("4447");
        patInfo.addElement("TCM_DIAG_NAME").setText("测试2");
//        patInfo.addElement("TCM_DIAG_DR_CODE").setText("12412");
//        patInfo.addElement("TCM_DIAG_DR_NAME").setText("112");
        patInfo.addElement("DEPT_CODE").setText("201");
        patInfo.addElement("DEPT_NAME").setText("心血管内科");
//        patInfo.addElement("WARD_CODE").setText("1241");
//        patInfo.addElement("WARD_NAME").setText("12412");
        patInfo.addElement("ACCOUNT_NUM").setText("5555566666");
        patInfo.addElement("SUBOR_HOSPITAL_DISTRICT").setText("省中医");
        patInfo.addElement("ADMIT_DEPT_CODE").setText("201");
        patInfo.addElement("ADMIT_DEPT_NAME").setText("心血管内科");
        patInfo.addElement("ADMIT_DATE").setText("2020-01-17 15:44:17");
        // 5、设置生成xml的格式
        OutputFormat format = OutputFormat.createPrettyPrint();
        // 设置编码格式
        format.setEncoding("UTF-8");
        String xml = document.asXML();
        System.out.println(xml);
//        String res = service.outHOSREG(xml);
        TBasicWebServiceService serviceService=new TBasicWebServiceService();
        TBasicWebService service = serviceService.getTBasicWebServicePort();
        String res = service.outHOSCAN(xml);
        System.out.println(res);
    }
}
